package com.liss.lissaiagent.tool;


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;

/**
 * @Author: Mr.Li
 * @CreateTime: 2025-10-15
 * @Description: 网页抓取工具
 * @Version: 1.0
 */
public class WebScrapingTool {

    @Tool(description = "scrap the content of a web page")
    public String scrapWebPage(@ToolParam(description = "URL of the web page to scrape") String url){
        try {
            Document document = Jsoup.connect(url).get();
            return document.html();
        } catch (Exception e) {
            return "Error scraping web page" +   e.getMessage();
        }
    }
}
